package com.tinyseed.emcp.api.productionRule.repository;

import com.tinyseed.emcp.api.productionRule.entity.Distribution;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * 版权所有 © Copyright 2019<br>
 *
 * @Description: <br>
 * @CreateDate: Created in 2019/11/2 16:18 <br>
 * @Author: Simon.Yu
 * @Modify:
 */
public interface DistributionRepository extends JpaRepository<Distribution, Long>, JpaSpecificationExecutor<Distribution> {

    List<Distribution> findAllByProducesetId(@Param("producesetId") Long producesetId);

    Distribution findByMonitorId(@Param("monitorId") Long monitorId);

    void deleteAllByProducesetId(@Param("producesetId") Long producesetId);

    void deleteAllByMonitorIdIsIn(@Param("monitorIds") Long[] monitorIds);

    List<Distribution> findALLByMonitorIdIsIn(@Param("monitorIds") String[] monitorIds);

    void deleteAllByProducesetIdIsIn(@Param("producesetIds") List<Long> producesetIds);

}
